#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/videodev2.h>
#include <string.h>
#include <sys/mman.h>
#include <assert.h>
#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>

using namespace std;
using namespace cv;
typedef cv::Point3_<uchar> Pixel;

int main() {
	Mat img = imread("in.jpg", IMREAD_UNCHANGED);
	Mat subImg = img(Range(0, 200), Range(0, 200));
	if (img.empty()) {
		printf("No image data \n");
		return -1;
	}
	for (Pixel &p : cv::Mat_<Pixel>(subImg)) {
		p.z = 255;
	}
	imwrite("out.jpg", img);
	return 0;
}
